load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "logutil",
    srcs = [
        "context.go",
        "logging.go",
        "rate.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/logutil",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/lightning/metric",
        "//br/pkg/redact",
        "//pkg/kv",
        "@com_github_google_uuid//:uuid",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_log//:log",
        "@com_github_prometheus_client_golang//prometheus",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "logutil_test",
    timeout = "short",
    srcs = ["logging_test.go"],
    flaky = True,
    shard_count = 11,
    deps = [
        ":logutil",
        "//br/pkg/errors",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
        "@org_uber_go_zap//zaptest/observer",
    ],
)
